Week 3 pull request - Panda and Tiger Levels#13
Open
moserrya wants to merge 1 commit intoRubyoffRails:masterfrom
moserrya:master
Open
Week 3 pull request - Panda and Tiger Levels#13moserrya wants to merge 1 commit intoRubyoffRails:masterfrom moserrya:master
moserrya wants to merge 1 commit intoRubyoffRails:masterfrom
moserrya:master
Conversation
Member
There was a problem hiding this comment.
You could probably pull this out into two different methods... maybe something like:
def retry_find_date(times)
retry_attempts = 0
begin
retry_attempts += 1
return find_date
rescue InvalidDateError
if retry_attempts < times
puts "That is not a valid day of the week. Please try again."
retry
else
puts "No valid date entered, giving shows for today (#{user_date})"
return days_of_the_week[Time.new.wday]
end
end
end
class InvalidDateError < StandardError; end
def find_date
Date::DAYNAMES.fetch(gets.chomp.capitalize) { raise InvalidDateError.new }
end
Then you'd use it in subjectively cleaner way:
date = retry_find_date(3)
Network.all###
Member
|
Most excellent job on this. the comments I left were dealing with organizing code into smaller methods, not with your logic (which was sound). Let me know if you have questions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spent some time in the Tiger on handling bad inputs. Would love your take on this!
Think I can complete Eagle without fully understanding everything going on, so I am going go spend more time digging in to ActiveRecord first.
Thanks!